package net.zoneland.knowledge.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

public enum HotQueEnum {

    /**
     *热点问题.
     */
    HOT_QUESTION("HOT_QUESTION","热点问题"),
    /**
     * 搜索排行版.
     */
    SEARCH_RANK("SEARCH_RANK","搜索排行榜");

    private String name;
    private String value;

    HotQueEnum(String name, String value) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static HotQueEnum getByValue(String value) {
        for (HotQueEnum hotQueEnum : HotQueEnum.values()) {
            if (hotQueEnum.value.equals(value)) {
                return hotQueEnum;
            }
        }
        return null;
    }
    
   public static List toList() {
       List list = new ArrayList();
       for (HotQueEnum hotQueEnum : HotQueEnum.values()) {
           HashMap<String, String> map = new HashMap<String,String>();
           map.put("name",hotQueEnum.getName());
           map.put("value", hotQueEnum.getValue());
           list.add(map);
       }
       return list;
   }
}
